home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 5894 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.5 KB  |  58 lines

  1. Path: news.kreonet.re.kr!usenet
  2. From: jwhahn@cair.kaist.ac.kr (Jung Hahn)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: need help on VERY simple program. I am a beginner, so this is an easy question!!!
  5. Date: Wed, 07 Feb 1996 11:47:49 GMT
  6. Organization: Applied Database Labs, K.A.I.S.T
  7. Message-ID: <31189141.13549485@news.kreonet.re.kr>
  8. References: <31158A73.3B43@neosoft.com>
  9. NNTP-Posting-Host: swine.kaist.ac.kr
  10. X-Newsreader: Forte Agent .99d/32.168
  11.  
  12. On Sun, 04 Feb 1996 22:41:23 -0600, reynolds@neosoft.com wrote:
  13. >
  14. >main ()
  15. >{
  16. >    long integer1, integer2, sum, difference, product, quotient;
  17. >    cout << "enter first integer\n";
  18. >    cin >> integer1;
  19. >    cout << "enter second integer\n";
  20. >    cin >> integer2;
  21. >    if (integer1 == integer2)
  22. >        cout << "These two numbers are equal!!\n";
  23. >    if (integer1 > integer2)
  24. >        cout << "First integer greater than second!!\n";
  25. >    else
  26. >//This is the statement which I want to clear IF integer1 == integer2    
  27. >        cout << "Second integer greater than first!!\n";
  28. >and so on. . . 
  29. >                 ---John Reynolds
  30.  
  31. HMM ... Yeah .... SHIT ... 
  32.  
  33. The Basic thing is YOU WANNA cout << "STRING" using the ternary
  34. operator.
  35.  
  36. Read the chapter concerning Assignments and then Read the Chapter on
  37. Pointers ... 
  38.  
  39. then try this.
  40.  
  41. ( in C )
  42.  
  43. void main( void) 
  44. {
  45. char *string1;
  46. string1 =  ( int1==int2) ? "These Two Numbers Are Equal\n" 
  47.                 : ( int1 > int2) ? "int1 is > than int2\n" : "Else\n";
  48.  
  49. printf( "%s", string1);
  50. }
  51.   
  52.  
  53. ___________
  54.  
  55.     Name:  Jung w. Hahn
  56.     Elm:   jwhahn@cair.kaist.ac.kr
  57.     Phone: 042-869-2959
  58.